﻿using MB.RuleBase.Common;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Business
{
    public class BLogin
    {
        //用户登录，并验证用户
        public UserInfo LogonUser(string userID, string userPswd)
        {
            try
            {
                // 验证输入的用户名是否正确
                UserInfo userInfo = GetUser(userID);
                return userInfo;
            }
            catch (Exception ex)
            {
                return null;
            }
        }

        // 取得用户信息
        public UserInfo GetUser(string userCode)
        {
            return DatabaseExcuteByXmlHelper.NewInstance.GetObjectsByXml<UserInfo>("Account", "GetUser", userCode).FirstOrDefault();
        }
    }
}
